package log

import (
	"fmt"
	"strings"
	"sync"
	"time"
)

var once sync.Once

func onces() {
	fmt.Println("onces")
}

func onced() {
	fmt.Println("onced")
}

func onceExample() {
	for i, v := range make([]string, 10) {
		once.Do(onces)
		fmt.Println("count:", v, "---", i)
	}

	for i := 0; i < 10; i++ {
		go func() {
			once.Do(onced)
			fmt.Println("213")
		}()
	}

	time.Sleep(4000)

	cmds := [][]string{[]string{"kubectl", "label", "node", "1.1.1.1", "dos:app"}}

	if 1 > 0 {
		cmds = append(cmds, []string{"kubectl", "taint", "nodes", "20.26.38.134", "app=haproxy:NoSchedule"})
	}

	fmt.Println(strings.Join(cmds[1], " "))

}
